#ifndef MUTEXSCOPEDLOCK_HPP_
# define MUTEXSCOPEDLOCK_HPP_

# include "Mutex.hpp"
# include "Utils/macros.hpp"

namespace wrappers {
namespace pthread {
/*! \class MutexScopedLock
 * \brief ScopedLockmatic mutex locking / unlocking
 * This class provide a mutex which will be automatically locked
 * upon construction and unlocked upon destruction
 */
class MutexScopedLock {
public:
  /*! Default constructor
   * \param mutex : a reference on the Mutex object to use */
  MutexScopedLock(Mutex &mutex);
  /*! Virtual destructor */
  virtual ~MutexScopedLock();

protected:
  /*! Disallow copy constructor and assignment operator */
  DISALLOW_COPY_AND_ASSIGN(MutexScopedLock);

  Mutex &mMutex; /*!< Reference on the Mutex object to lock */
};
}
}

#endif /* !MUTEXSCOPEDLOCK_HPP_ */
